<?php
    class Model{
        protected static $config = array(
            'type' => 'mysql',
            'host' => 'localhost',
            'db' => 'test',
            'user' => 'root',
            'password' => '123456',
        );

        public $obj;

        public function __construct(array $config = array()){
            $config_arr = $config?array_merge(self::$config,$config):self::$config;
            $this->config($config_arr);
        }

        protected function config(array $config = array()){
            $pdo_dsn = $config['type'].':host='.$config['host'].';dbname='.$config['db'];
            $this->obj = new PDO($pdo_dsn,$config['user'],$config['password']);
        }
    }